<template>
  <div class="screen-block">
    <div class="content_title">重点品类排名</div>
    <BorderBox1>
      <div id="mainMap3" style="width: 100%; height: 100%"></div>
    </BorderBox1>
  </div>
</template>

<script setup lang="ts">
import { onMounted } from 'vue';
import { BorderBox1 } from '@kjgl77/datav-vue3';
// import * as echarts from 'echarts';
import { init, EChartsOption } from 'echarts';

const initalECharts4 = () => {
  const myChart = init(document.getElementById('mainMap3') as HTMLDivElement);
  let option: EChartsOption = {
    color: ['#ff832e', '#37cbff', '#b3e269'],
    legend: {
      top: 30,
      data: ['美妆', '理财', '教育', '母婴', '百货'],
      textStyle: {
        fontSize: 12,
        color: '#ffffff',
      },
      icon: 'circle',
      itemWidth: 10, // 设置宽度

      itemHeight: 10, // 设置高度

      itemGap: 10, // 设置间距
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true,
    },
    xAxis: {
      type: 'value',
      splitLine: {
        show: true,
        lineStyle: {
          color: ['#07234d'],
        },
      },
      axisLabel: {
        show: true,
        textStyle: {
          color: '#c3dbff', //更改坐标轴文字颜色
          fontSize: 12, //更改坐标轴文字大小
        },
      },
    },
    yAxis: {
      type: 'category',
      data: ['上海', '广州', '杭州', '天津', '北京', '厦门', '合肥'],
      axisLabel: {
        show: true,
        textStyle: {
          color: '#c3dbff', //更改坐标轴文字颜色
          fontSize: 12, //更改坐标轴文字大小
        },
      },
    },
    series: [
      {
        name: '美妆',
        type: 'bar',
        stack: '总量',
        label: {
          show: false,
          position: 'insideRight',
        },
        data: [320, 302, 301, 334, 390, 330, 320],
      },
      {
        name: '理财',
        type: 'bar',
        stack: '总量',
        label: {
          show: false,
          position: 'insideRight',
        },
        data: [120, 132, 101, 134, 90, 230, 210],
      },
      {
        name: '教育',
        type: 'bar',
        stack: '总量',
        label: {
          show: false,
          position: 'insideRight',
        },
        data: [220, 182, 191, 234, 290, 330, 310],
      },
      {
        name: '母婴',
        type: 'bar',
        stack: '总量',
        label: {
          show: false,
          position: 'insideRight',
        },
        data: [150, 212, 201, 154, 190, 330, 410],
      },
      {
        name: '百货',
        type: 'bar',
        stack: '总量',
        label: {
          show: false,
          position: 'insideRight',
        },
        data: [820, 832, 901, 934, 1290, 1330, 1320],
      },
    ],
  };
  myChart.setOption(option);
};
onMounted(() => {
  initalECharts4();
});
</script>

<style lang="scss" scoped>
.screen-block {
  width: 100%;
  height: 100%;
  position: relative;
  .content_title {
    width: 200px;
    text-align: center;
    color: #01c4f7;
    font-size: 14px;
    position: absolute;
    top: 0;
    left: 50%;
    margin-left: -100px;
  }
}
</style>
